home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / src / vb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-13  |  3.4 KB  |  113 lines

  1. /* $Id: vb.h,v 1.3 1996/12/18 19:59:44 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  2.0
  6.  * Copyright (C) 1995-1996  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: vb.h,v $
  26.  * Revision 1.3  1996/12/18 19:59:44  brianp
  27.  * removed the material bitmask constants
  28.  *
  29.  * Revision 1.2  1996/09/27 01:31:17  brianp
  30.  * added gl_init_vb() prototype
  31.  *
  32.  * Revision 1.1  1996/09/13 01:38:16  brianp
  33.  * Initial revision
  34.  *
  35.  */
  36.  
  37.  
  38. /*
  39.  * Vertex buffer:  vertices from glVertex* are accumulated here until
  40.  * the buffer is full or glEnd() is called.  Then the buffer is flushed
  41.  * (rendered) and reset.
  42.  */
  43.  
  44.  
  45. #ifndef VB_H
  46. #define VB_H
  47.  
  48.  
  49. #include "types.h"
  50.  
  51.  
  52.  
  53. /* Flush VB when this number of vertices is accumulated:  (a multiple of 12) */
  54. #define VB_MAX 480
  55.  
  56. /* Arrays must also accomodate new vertices from clipping: */
  57. #define VB_SIZE  (VB_MAX + 2 * (6 + MAX_CLIP_PLANES))
  58.  
  59.  
  60. /*
  61.  * Vertex buffer (not saved/restored on context switches)
  62.  */
  63. struct vertex_buffer {
  64.         GLfloat Obj[VB_SIZE][4];        /* Object coords */
  65.     GLfloat Eye[VB_SIZE][4];    /* Eye coords */
  66.     GLfloat Clip[VB_SIZE][4];    /* Clip coords */
  67.     GLfloat Win[VB_SIZE][3];    /* Window coords */
  68. #ifdef MONDELLO
  69.         GLint   Win2[VB_SIZE][3];       /* Integer window coords -PFM */
  70.                                         /* NOTE: on mondello uses correctly */
  71. #endif
  72.  
  73.         GLfloat Normal[VB_SIZE][3];     /* Normal vectors */
  74.  
  75.         /* Colors are values in [0..RedScale], [0..GreenScale], [0,BlueScale],
  76.          * [0,AlphScale] and stored as integers if flat shading or as fixed
  77.          * point numbers if smooth shading.
  78.          */
  79.     GLfixed Fcolor[VB_SIZE][4];    /* Front colors */
  80.     GLfixed Bcolor[VB_SIZE][4];    /* Back colors */
  81.     GLfixed (*Color)[4];        /* == Fcolor or Bcolor */
  82.  
  83.     GLuint Findex[VB_SIZE];         /* Front color indexes */
  84.     GLuint Bindex[VB_SIZE];         /* Back color indexes */
  85.     GLuint *Index;            /* == Findex or Bindex */
  86.  
  87.     GLboolean Edgeflag[VB_SIZE];    /* Polygon edge flag */
  88.  
  89.         GLfloat TexCoord[VB_SIZE][4];   /* Texture coords */
  90.  
  91.         GLubyte Unclipped[VB_SIZE];    /* 0=clipped, 1=not clipped */
  92.         GLboolean AnyClipped;        /* Were any vertices clipped? */
  93.  
  94.     GLuint Start;            /* First vertex to process */
  95.     GLuint Count;            /* Number of vertexes in buffer */
  96.     GLuint Free;            /* Next empty position for clipping */
  97.  
  98.         /* to handle glMaterial calls inside glBegin/glEnd: */
  99.     GLboolean MaterialChanges;    /* True if any glMaterial was called */
  100.         GLuint MaterialMask[VB_SIZE];    /* What material values to change */
  101.     struct gl_material Material[VB_SIZE][2]; /* New material settings */
  102.  
  103.         GLboolean MonoColor;        /* Do all vertices have same color? */
  104. };
  105.  
  106.  
  107.  
  108. extern void gl_init_vb( struct vertex_buffer* VB );
  109.  
  110.  
  111. #endif
  112.  
  113.